<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script>
			var user = {
				name: "夕",
				age: 16,
				sex: '女'
				//	测试  	console.log(user);
				//{name: '夕', age: 16, sex: '女'}
			}
			//对象转化为json字符串
			var jsonUser = JSON.stringify(user);
			//console.log(jsonUser);
			//{"name":"夕","age":16,"sex":"女"}
			//json 字符串转化为对象 参数为json字符串
			//JSON.parse(jsonUser);
			var obj = JSON.parse('{"name":"棘刺","age":16,"sex":"女"}');
			//测试 console.log(obj)
			
			//JSON和js对象的区别
			var obj1 = {a: "hello",b:"hello"};
			var json='{"a": "hello","b":"hello"}';
		</script>
	</body>
</html>
